package com.starblink.product.detail.adapter

import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import com.starblink.android.basic.adapter.BaseVH
import com.starblink.product.detail.adapter.view.ProductDetailCardView
import com.starblink.rocketreserver.fragment.ProductD

class ProductDetailCell(
    parent: ViewGroup,
    val activity: AppCompatActivity,
    val list: ArrayList<Any>, val traceId: String, val pageTrackTag: String
) : BaseVH<ProductD>(ProductDetailCardView(parent.context)) {

    private val cardView = itemView as ProductDetailCardView

    override fun onBind(post: ProductD, position: Int) {
        itemView.tag = post
        cardView.bindPost(
            activity,
            post,
            position,
            if (position == 0) traceId else "",
            isFromFeeds = list.size == 1,
            hasNext = list.size == 1 || position < list.size - 1,
            showGuide = list.size == 1, pageTrackTag = pageTrackTag
        )
    }
}